package com.eddie.decorator;

/**
 * 装饰者
 * @author Eddie
 * @date 2022/08/01 09:16
 **/
public class Decorator extends Drink{

    private final Drink drink;

    public Decorator(Drink drink) {
        this.drink = drink;
    }

    @Override
    public float cost() {
        //getPrice是自己的价格
        return super.getPrice() + drink.cost();
    }

    @Override
    public String getDes() {
        //drink.getDes()输出被装饰着的描述信息
        return super.des+""+super.getPrice()+" && " + drink.getDes();
    }
}
